package com.json.webapp.util.disptags;

import java.util.Date;

import javax.servlet.jsp.PageContext;

import org.apache.commons.lang.time.FastDateFormat;
import org.displaytag.decorator.DisplaytagColumnDecorator;
import org.displaytag.exception.DecoratorException;
import org.displaytag.properties.MediaTypeEnum;

public class TimestampToDate implements DisplaytagColumnDecorator {

	private FastDateFormat dateFormat = FastDateFormat
			.getInstance("MM/dd/yyyy "); //$NON-NLS-1$

	@Override
	public Object decorate(Object columnValue, PageContext pageContext,
			MediaTypeEnum media) throws DecoratorException {
		Date date = (Date) columnValue;
		return this.dateFormat.format(date);
	}

}
